package com.aviccxzx.smarthome.UserModule;

import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.aviccxzx.smarthome.R;
import com.aviccxzx.smarthome.base.GosUserModuleBaseActivity;

import java.util.ArrayList;


/**
 * Created by joey on 2016/10/25.
 */
public class SoftApActivity extends GosUserModuleBaseActivity implements View.OnClickListener {

    TextView soft_wifi;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setContentView(R.layout.softap_lay);
        }else {
        }
        ((TextView) findViewById(R.id.title_tv)).setText("关于我们");
        findViewById(R.id.ll_title_left_view).setOnClickListener(this);
        soft_wifi = (TextView) findViewById(R.id.soft_wifi);
        searchWifi();
    }

    public void searchWifi(){
        // 获取系统wifi服务
        WifiManager wm = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE);
        // 获取扫描到的所有wifi信息
        ArrayList<ScanResult> scanResults = (ArrayList<ScanResult>) wm.getScanResults();
        for (int i = 0; i <scanResults.size() ; i++) {
            if (scanResults.get(i).SSID.equals("HUAWEI - APP")){
                soft_wifi.setText("HUAWEI - APP");
            }
        }

    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_title_left_view:
                finish();
                break;
        }
    }
}
